﻿/*
			Author: Ozcan Degirmenci (Boot)
			E-Mail: odegirmenci@hotmail.com
			Date:	4 Jan 2005
*/

#region Using directives

using System;
#if WHIDBEY
using System.Collections.Generic;
#endif
using System.Text;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;

#endregion

#if WHIDBEY
namespace Ling.ZhControls
{
	/// <summary>
	///  Designer Actions class.
	/// Not supported in VS.NET 2003
	/// </summary>
	public class SimpleTabDesignerActions : DesignerActionList
	{
		SimpleTabControl tabControl = null;
		SimpleTabControlDesigner Designer = null;

		public SimpleTabDesignerActions(SimpleTabControl control, 
			SimpleTabControlDesigner designer)
		{
			tabControl = control;
			Designer = designer;
		}

		public override DesignerActionItem[] GetSortedActionItems()
		{
			DesignerActionItem[] items = new DesignerActionItem[17];
			int i = 0;
			items[i++] = new DesignerActionHeaderItem("Properties");
			items[i++] = new DesignerActionHeaderItem("Methods");
			items[i++] = new DesignerActionHeaderItem("Information");
			items[i++] = new DesignerActionMethodItem(this,
				"AddNew", "Add new Tab", "Methods", 
				"Add new tab page to the control", true);
			items[i++] = new DesignerActionMethodItem(this,
				"RemoveSelected", "Remove Selected Tab", 
				"Methods", "Remove selected tab", true);
			items[i++] = new DesignerActionMethodItem(this,
				"MoveLeft", "Move Left", "Methods", 
				"Move to the left", true);
			items[i++] = new DesignerActionMethodItem(this,
				"MoveRight", "Move Right", "Methods", 
				"Move to the right", true);
			items[i++] = new DesignerActionPropertyItem("SelectedIndex",
				"Selected Tab Index", "Properties",
				"Indicates the selected tabs selected index");

			items[i++] = new DesignerActionPropertyItem("ShowTabsArea",
				"Show Tabs Area", "Properties",
				"Indicates the tabs area will be shown or not");

			items[i++] = new DesignerActionPropertyItem("DrawMode",
				"Draw Mode", "Properties",
				"Indicates the drawmode");

			items[i++] = new DesignerActionPropertyItem("FixTabWidth", 
				"Fix Tab Width", "Properties", 
				"Indicates the fix width property");

			items[i++] = new DesignerActionPropertyItem("TabsBackColor",
				"TabsBackColor", "Properties",
				"Tabs Backcolor. Not seen if ShowTabsArea is false");

			items[i++] = new DesignerActionPropertyItem("SelectedTabColor",
				"Selected Tab Color", "Properties",
				"Indicates the selected tab color");

			items[i++] = new DesignerActionPropertyItem("TabColor",
				"Tab Color", "Properties",
				"Indicates the tab color");

			items[i++] = new DesignerActionPropertyItem("TabGradientColor",
				"Tabs Gradient Color", "Properties",
				"Indicates the gradient color for tabs");

			items[i++] = new DesignerActionTextItem("Total Tab Count: " 
				+ tabControl.Tabs.Count.ToString(), "Information");
			items[i++] = new DesignerActionTextItem("First Visible Tab Index: " 
				+ tabControl.FirstVisible.ToString(), "Information");
			return items;
		}

		public void AddNew ()
		{
			Designer.OnAddCommand(this, EventArgs.Empty);
		}

		public void RemoveSelected()
		{
			Designer.OnRemoveCommand(this, EventArgs.Empty);
		}

		public void MoveLeft()
		{

			if (tabControl.NeedLeftIcon)
			{
				tabControl.FirstVisible--;
				return;
			}
		}

		public void MoveRight()
		{
			if (tabControl.NeedRightIcon)
			{
				tabControl.FirstVisible++;
				return;
			}
		}

		public int FixTabWidth
		{
			get { return tabControl.FixTabWidth; }
			set { tabControl.FixTabWidth = value; }
		}

		public TabDrawMode DrawMode
		{
			get { return tabControl.DrawMode; }
			set { tabControl.DrawMode = value; }
		}

		public bool ShowTabsArea
		{
			get { return tabControl.ShowTabsArea; }
			set { tabControl.ShowTabsArea = value; }
		}

		public Color TabsBackColor
		{
			get { return tabControl.TabsBackColor; }
			set { tabControl.TabsBackColor = value; }
		}

		public Color SelectedTabColor
		{
			get { return tabControl.SelectedTabColor; }
			set { tabControl.SelectedTabColor = value; }
		}

		public Color TabColor
		{
			get { return tabControl.TabColor; }
			set { tabControl.TabColor = value; }
		}

		public Color TabGradientColor
		{
			get { return tabControl.TabGradientColor; }
			set { tabControl.TabGradientColor = value; }
		}

		public int SelectedIndex
		{
			get { return tabControl.SelectedIndex; }
			set { tabControl.SelectedIndex = value; }
		}
	}
}
#endif
